Ok what i am trying to do with my script i send a poll and receive a reply and read that reply. I have the Poll work properly but what i need help with is trying to convert the reply from ascii to regular text.
My reply consist of 30 different variables and i need them to be separated. my code so far is. - #!/usr/bin/perl
-
-
print "Content-type:text/html\n\n";
-
use IO::Socket;
-
-
#Poll
-
my $header = 'Art-Net';
-
my $space = ' ';
-
my $Prover = chr(0x0e);
-
my $filler = chr(0x00);
-
my $ttm = chr(0x02);
-
my $ID = $header.$filler;
-
-
my $ArtPoll = $ID.$filler.$space.$filler.$Prover.$ttm.$filler;
-
-
-
#My Reply.
-
my $T_ArtPollReply = pack("A8 S C C C C C C C C C S C18 C64 C64 C C C C C C C C C C C C C C C6 C32",
-
$ID,
-
$OpCode,
-
$BoxAddr,
-
$VersionInfoH,
-
$VersionInfo,
-
$SubSwitchH,
-
$SubSwitch,
-
$OemH,
-
$Oem,
-
$UbeaVersion,
-
$Status,
-
$EstaMan,
-
$ShortName,
-
$LongName,
-
$NodeReport,
-
$NumPortsH,
-
$NumPorts,
-
$PortTypes,
-
$GoodInput,
-
$GoodOutput,
-
$Swin,
-
$Swout,
-
$SwVideo,
-
$SwMacro,
-
$SwRemote,
-
$Spare1,
-
$Spare2,
-
$Spare3,
-
$Style,
-
$Mac,
-
$Filler,
-
);
-
-
$Node_Ip = '2.0.0.1';
-
-
my $poll = IO::Socket::INET->new(
-
PeerAddr => $Node_Ip,
-
PeerPort => "6454",
-
Proto => "udp",
-
LocalPort => "6454",
-
);
-
-
sub ArtPoll {
-
$poll->send($ArtPoll);
-
print "ArtPoll sent.\n<hr>";
-
-
sub Reply {
-
$poll->recv($T_ArtPollReply,250);
-
print $T_ArtPollReply;
-
}
-
&Reply;
-
}
-
-
&ArtPoll;
-
When i run it i try to print the reply but i get[HTML]<br>[/HTML] Art-Net??!??6? ??ÒLATest1??? ??????????Test Node ??????????????? ??????????????? ??????????????? ?????????#0001 [0019] Power On Tests Pass??????????? ??????????????? ???????€€????? ?€€?????????? ??????¦?
i know i have to do something with unpack or something but not sure if some one could help me out it would be very helpful.
0 1415 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Johannes |
last post by:
Hi,
I tried to pack eight integer values and one string into one binary
string, which I would like to store in a mysql db.
I encountered two problems doing this:
1)
$this->packed = pack('N8A*', $this->value1, $this->value2,
$this->value3, $this->value4, $this->value5, $this->value6,
$this->value7, $this->value8, $this->stringvalue);
|
by: Sergey Dorofeev |
last post by:
I can use string.unpack if string in struct uses fixed amount of bytes.
But is there some extension to struct modue, which allows to unpack
zero-terminated string, size of which is unknown?
E.g. such struct: long, long, some bytes (string), zero, short, short,
short.
|
by: Stacy Mader |
last post by:
Greetings all,
I have a VMS binary file with weather data. The record
on each line is 1xint(8) 12xint(2)
Using the perl unpack function, I can decode the
binary file like this:
<snip>
|
by: p.lavarre |
last post by:
Can Python not express the idea of a three-byte int?
For instance, in the working example below, can we somehow collapse the
three calls of struct.pack into one?
08 12 34 56 80 00
I ask because I'm trying to refactor working code that is concise:
08 12 34 56 80 00
|
by: Steve |
last post by:
Are there any gurus of the pack/unpack world out there that can help me
with this one?
I have an encrypted string which I'm reading from a zipped file. It was
written using
pack ( "la" . strlen (encrypted), strlen (encrypted), strlen (encrypted))
most of the time, it decrypts correctly when I unpack as...
| |
by: andmarti |
last post by:
If I build a strict with:
import struct
print struck.pack ('i', 1)
it returns a '\n'.
What's wrong with it???
:(
--
|
by: praveen0437 |
last post by:
hi
i know about format argument in pack and unpack like b h i etc but in some cases i am getting < or = symbols along with them what does they signifies
for example struct.pack( "<cI", 'n', var1 )
|
by: tmp123 |
last post by:
Hello,
Thanks for your time.
After review the "struct" documentation, it seems there are no option
to pack/unpack zero terminated strings.
By example, if the packed data contains: byte + zero terminated string
+ zero terminated string + byte, it seems no possible to unpack it
using "struct".
|
by: joe shoemaker |
last post by:
If you have the following:
data = unpack('>L', sock.recv(4))
Does this line of code means that incoming data is big endian and
unpack it to endianess of local machine? If local machine is little
endian, then big endian is automatically converted to little endian
format?
thank you.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |